package modelo;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "caracteristica", catalog = "eventos_compartidos")
public class Caracteristica implements java.io.Serializable {

	private static final long serialVersionUID = 4342439091321532229L;

	private Integer idCaracteristica;
	private String nombreCaracteristica;
	private Set<Salon> salons = new HashSet<Salon>(0);

	public Caracteristica() {
	}

	public Caracteristica(String nombreCaracteristica) {
		this.nombreCaracteristica = nombreCaracteristica;
	}

	public Caracteristica(String nombreCaracteristica, Set<Salon> salons) {
		this.nombreCaracteristica = nombreCaracteristica;
		this.salons = salons;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idCaracteristica", unique = true, nullable = false)
	public Integer getIdCaracteristica() {
		return this.idCaracteristica;
	}

	public void setIdCaracteristica(Integer idCaracteristica) {
		this.idCaracteristica = idCaracteristica;
	}

	@Column(name = "nombreCaracteristica", nullable = false, length = 50)
	public String getNombreCaracteristica() {
		return this.nombreCaracteristica;
	}

	public void setNombreCaracteristica(String nombreCaracteristica) {
		this.nombreCaracteristica = nombreCaracteristica;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "caracteristicaxsalon", catalog = "eventos_compartidos", joinColumns = { @JoinColumn(name = "idCaracteristica", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "idSalon", nullable = false, updatable = false) })
	public Set<Salon> getSalons() {
		return this.salons;
	}

	public void setSalons(Set<Salon> salons) {
		this.salons = salons;
	}

}